package com.menu.Controller;

import com.menu.Pojo.SecurityUser;
import com.menu.Service.AttentionService;
import com.menu.Utils.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.annotation.Secured;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import javax.annotation.Resource;

@Api(tags = "关注接口")
@RestController
public class AttentionController {

    @Resource
    AttentionService attentionService;


    @ApiOperation(value = "关注功能")
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(name = "userOneId", value = "关注者id(当前登录账号)",required = true),
                    @ApiImplicitParam(name = "userTwoId", value = "被关注者id", required = true)
            }
    )
    @PostMapping("/User/attention")
    public ResponseResult attention(Integer userOneId, Integer userTwoId){
        return attentionService.attention(userOneId, userTwoId);
    }


    @ApiOperation(value = "判断是否关注")
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(name = "userOneId", value = "关注者id(当前登录账号)", required = true),
                    @ApiImplicitParam(name = "userTwoId", value = "被关注者id", required = true)
            }
    )
    @PostMapping("/User/judgeOfAttention")
    public ResponseResult judgeOfAttention(Integer userOneId, Integer userTwoId){
        return attentionService.judgeOfAttention(userOneId, userTwoId);
    }



    @ApiOperation(value = "遍历某用户的关注列表")
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(name = "userId", value = "用户id", required = true)
            }
    )
    @GetMapping("/Visitor/findMyAttention")
    public ResponseResult findMyAttention(Integer userId,Integer pageNow,Integer pageSize){
        return attentionService.findMyAttention(userId,pageNow,pageSize);
    }


    @ApiOperation(value = "遍历某用户的粉丝列表")
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(name = "userId", value = "用户id", required = true)
            }
    )
    @GetMapping("/Visitor/findMyFans")
    public ResponseResult findMyFans(Integer userId,Integer pageNow,Integer pageSize){
        return attentionService.findMyFans(userId,pageNow,pageSize);
    }


}
